const util = require('../../utils/util.js');
const api = require('../../config/api.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    products: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getIndexData();
  },
  getIndexData: function () {
    let that = this;
    util.request(api.SelectProductsUrl).then(function (res) {
      if (res.success) {
        that.setData({
          products: res.data
        });
      }
    });
  }
  
})